# -*- coding: utf-8 -*-
class NewError(object):
    def __init__(self, code, message):
        self.result = {'code': code, 'message': message, 'data': {}}

    def data(self, data=None):
        if data is None:
            data = {}
        self.result['data'] = data
        return self.result


OK = NewError(0, "success")

ErrServerRuntime = NewError(1000, "Service running exception")
ErrServerTokenSign = NewError(1001, "鉴权失败")
ErrServerTokenExpires = NewError(1002, "令牌过期")
ErrServerPermissionDenied = NewError(1003, "权限不足")
ErrServerParam = NewError(1004, "缺少请求参数或请求参数不合规")
ErrServerDocumentExist = NewError(1005, "该条记录已存在")
ErrServerDocumentNotExist = NewError(1006, "该条记录不存在")
ErrServerParamValue = NewError(1007, "请求参数的值不合规")


ErrUserOrPwdNull = NewError(1101, "用户名或密码不能为空")
ErrUserOrPwd = NewError(1102, "用户不存在或用户名密码错误")

ErrDishNameCreateExist = NewError(2000, "菜名已存在,不允许重复创建")
ErrDishNameEditExist = NewError(2001, "菜名已存在,不允许改成已存在菜名")

ErrDiningDelForbid = NewError(3001, "该餐厅下有档口,不允许删除")
ErrStallDelForbid = NewError(3002, "该档口下有菜,不允许删除")

